
<%= form_for(@post) do |f| %>
  <% if @post.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:</h2>

      <ul>
      <% @post.errors.full_messages.each do |msg| %>
        <li><%= msg %></li>
      <% end %>
      </ul>
    </div>
  <% end %>
	
  <p><label for="category selector">카테고리 :</label>
  	<%if @post.title.blank?%>
		<%= f.collection_select(:category, @category, :id, :name) %>
	<%else%>
		<%= f.collection_select(:category, @category, :id, :name, {:selected => @post.category.id}) %>
	<%end%>
	</p>
  <div class="field">
    <%= f.label :title %><br>
    <%= f.text_field :title %>
  </div>
  <div class="field">
    <%= f.label :content %><br>
    <%= f.text_field :content %>
  </div>
  <div class="field">
    <%= f.label :name %><br>
    <%= f.text_field :name %>
   </div>
  <div class="field">
    <%= f.label :tags %><br>
    <%= f.text_field :tags %>
   </div>
  <div class="actions">
    <%= f.submit %>
  </div>
<% end %>